﻿//
// Copyright (c) 2024 BPer
//
#ifndef ___BPerAudioCaptureHandle__
#define ___BPerAudioCaptureHandle__
#include <bperutil/buffer/BPerAudioBuffer.h>
#include <bperavutil/audio/BPerAudioUtil.h>
#include <bperavutil/audio/BPerRtcAec.h>
#include <bperutil/BPerAvInfoType.h>

class BPerAudioCaptureHandle {
public:
    BPerAudioCaptureHandle(BPerAVInfo *avinfo);
	virtual ~BPerAudioCaptureHandle(void);
    BPerRtcAec *m_aec;

public:
	void putBuffer(uint8_t *pBuffer,int32_t plen);
	void putBuffer2(uint8_t *pBuffer,int32_t plen);
	void putEchoBuffer(uint8_t *pBuffer,int32_t plen);
	void putEchoBuffer2(uint8_t *pBuffer,int32_t plen);
	void putEchoPlay(short *pbuf,int32_t plen);
	void startRecordWave(char *filename);
	void stopRecordWave();
	void setOutAudioBuffer(BPerAudioBuffer *plist);
	BPerAudioBuffer *m_aecPlayBuffer;
	BPerBool m_enableBuf;
private:

	int32_t hasPlayData;
	int32_t m_aecBufferFrames;
	int32_t isFirst;
	int32_t m_audioLen;
	short *pcm;

	BPerFrame m_audioFrame;
	BPerAudioBuffer *m_audioList;
	BPerAudioResample m_resample;
};
//#endif
#endif
